[VTD] print out debug message in vt-d fault handler only when iommu=debug is set
authorAllen Kay <allen.m.kay@intel.com>
Thu, 23 Jun 2011 10:11:24 +0000 (11:11 +0100)
committerAllen Kay <allen.m.kay@intel.com>
Thu, 23 Jun 2011 10:11:24 +0000 (11:11 +0100)
Print out debug messages in vtd_page_fault() handler only when
iommu=debug is set xen boot parameter.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
xen/drivers/passthrough/amd/iommu_acpi.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/iommu.h
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
xen/include/xen/iommu.h

index 84e246f7a1706b077cabc9d883ea3035f39bccdb..332537953bbd770b5a288fdff23d8bf93117d103 100644 (file)
@@ -817,7 +817,7 @@ static int __init parse_ivrs_table(struct acpi_table_header *_table)
 
     BUG_ON(!table);
 
-    if ( amd_iommu_debug )
+    if ( iommu_debug )
         dump_acpi_table_header(table);
 
     /* parse IVRS blocks */
index cd8d10a363fcb7453f609c1d9668433eea6aea3f..1e141a6227063eeb78098c42ba19579c26fa9119 100644 (file)
@@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1;
 bool_t __read_mostly iommu_qinval = 1;
 bool_t __read_mostly iommu_intremap = 1;
 bool_t __read_mostly iommu_hap_pt_share;
-bool_t __read_mostly amd_iommu_debug;
+bool_t __read_mostly iommu_debug;
 bool_t __read_mostly amd_iommu_perdev_intremap;
 
 static void __init parse_iommu_param(char *s)
@@ -74,8 +74,8 @@ static void __init parse_iommu_param(char *s)
             iommu_qinval = 0;
         else if ( !strcmp(s, "no-intremap") )
             iommu_intremap = 0;
-        else if ( !strcmp(s, "amd-iommu-debug") )
-            amd_iommu_debug = 1;
+        else if ( !strcmp(s, "debug") )
+            iommu_debug = 1;
         else if ( !strcmp(s, "amd-iommu-perdev-intremap") )
             amd_iommu_perdev_intremap = 1;
         else if ( !strcmp(s, "dom0-passthrough") )
index a8d806ba781d275a314ccd5ace6f5f29e096c302..23c6f2f1eb969752d0460a99fd22037918abdda8 100644 (file)
@@ -818,7 +818,7 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
 
     if ( fault_type == DMA_REMAP )
     {
-        dprintk(XENLOG_WARNING VTDPREFIX,
+        INTEL_IOMMU_DEBUG(
                 "DMAR:[%s] Request device [%02x:%02x.%d] "
                 "fault addr %"PRIx64", iommu reg = %p\n"
                 "DMAR:[fault reason %02xh] %s\n",
@@ -827,12 +827,13 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
                 PCI_FUNC(source_id & 0xFF), addr, iommu->reg,
                 fault_reason, reason);
 #ifndef __i386__ /* map_domain_page() cannot be used in this context */
-        print_vtd_entries(iommu, (source_id >> 8),
+       if (iommu_debug)
+            print_vtd_entries(iommu, (source_id >> 8),
                           (source_id & 0xff), (addr >> PAGE_SHIFT));
 #endif
     }
     else
-        dprintk(XENLOG_WARNING VTDPREFIX,
+        INTEL_IOMMU_DEBUG(
                 "INTR-REMAP: Request device [%02x:%02x.%d] "
                 "fault index %"PRIx64", iommu reg = %p\n"
                 "INTR-REMAP:[fault reason %02xh] %s\n",
@@ -846,26 +847,19 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type,
 static void iommu_fault_status(u32 fault_status)
 {
     if ( fault_status & DMA_FSTS_PFO )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Fault Overflow\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Fault Overflow\n");
     if ( fault_status & DMA_FSTS_PPF )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Primary Pending Fault\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Primary Pending Fault\n");
     if ( fault_status & DMA_FSTS_AFO )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Advanced Fault Overflow\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Fault Overflow\n");
     if ( fault_status & DMA_FSTS_APF )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Advanced Pending Fault\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Pending Fault\n");
     if ( fault_status & DMA_FSTS_IQE )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Invalidation Queue Error\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Queue Error\n");
     if ( fault_status & DMA_FSTS_ICE )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Invalidation Completion Error\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Completion Error\n");
     if ( fault_status & DMA_FSTS_ITE )
-        dprintk(XENLOG_ERR VTDPREFIX,
-            "iommu_fault_status: Invalidation Time-out Error\n");
+        INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Time-out Error\n");
 }
 
 #define PRIMARY_FAULT_REG_LEN (16)
index e75b24fb67e6ab23936199c1a21e73ba82be7e14..65cd703c1e51c5a8d561fee6b758532cb5f6381c 100644 (file)
@@ -512,4 +512,11 @@ struct intel_iommu {
     struct acpi_drhd_unit *drhd;
 };
 
+#define INTEL_IOMMU_DEBUG(fmt, args...) \
+    do  \
+    {   \
+        if ( iommu_debug )  \
+            dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args);    \
+    } while(0)
+
 #endif
index 10d6cc93d4bb4c50e8637c9e10e816e75858a670..b14e387538496f47c6e7ad18507b36dd1fe8cacf 100644 (file)
@@ -35,7 +35,7 @@
 #define AMD_IOMMU_DEBUG(fmt, args...) \
     do  \
     {   \
-        if ( amd_iommu_debug )  \
+        if ( iommu_debug )  \
             printk(XENLOG_INFO "AMD-Vi: " fmt, ## args);    \
     } while(0)
 
index 31476c20c1f1c3dcb6f14a12aa6f0783e84a2f44..d4c94d0c1650a458ef451878b32eec90958dcc90 100644 (file)
@@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose;
 extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
 extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;
 extern bool_t iommu_hap_pt_share;
-extern bool_t amd_iommu_debug;
+extern bool_t iommu_debug;
 extern bool_t amd_iommu_perdev_intremap;
 
 extern struct rangeset *mmio_ro_ranges;